package com.ruoyi.system.api.dept;

import com.ruoyi.common.core.core.domain.R;
import com.ruoyi.common.core.utils.bean.BeanUtils;
import com.ruoyi.system.api.dept.dto.PostRespDTO;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.service.ISysPostService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

@Service
public class PostApiImpl implements PostApi {

    @Resource
    private ISysPostService sysPostService;

    @Override
    public R<Boolean> validPostList(Collection<Long> ids) {
        sysPostService.validatePostList(ids);
        return R.ok(true);
    }

    @Override
    public R<List<PostRespDTO>> getPostList(Collection<Long> ids) {
        List<SysPost> list = sysPostService.listByIds(ids);
        return R.ok(BeanUtils.toBean(list, PostRespDTO.class));
    }

}
